<?php
import('baseview.class.php');

define('RESPONSE_S_OK',300);
define('RESPONSE_S_UPDATE',301);
define('RESPONSE_F_NICK_NEEDED', 321);
define('RESPONSE_F_UNKOWN_REASON', 322);
define('RESPONSE_F_TOO_MUCH',323);// 请求过于频繁
define('RESPONSE_F_UNKOWN_CODE',324);
define('RESPONSE_F_CODE_NEED',325);
define('RESPONSE_F_UNKOWN_UUID',326);
define('RESPONSE_F_RESPONSE_OWNER',327);
define('RESPONSE_F_UNKOWN_SESSION',328);


class ViewResponse extends BaseView{

	public function getViewByCode($code){
		switch($code){
			case RESPONSE_S_OK:
				return parent::getSuccessView(RESPONSE_S_OK, 'OK.');
				break;
				case RESPONSE_S_UPDATE:
					return parent::getSuccessView(RESPONSE_S_UPDATE, 'Update.');
					break;
			case RESPONSE_F_NICK_NEEDED:
				return parent::getFailedView(RESPONSE_F_NICK_NEEDED, 'Nick Name is needed.');
				break;
			case RESPONSE_F_TOO_MUCH:
				return parent::getFailedView(RESPONSE_F_TOO_MUCH, 'Request frequently.');
				break;
			case RESPONSE_F_CODE_NEED:
				return parent::getFailedView(RESPONSE_F_CODE_NEED, 'Code is need.');
				break;
			case RESPONSE_F_UNKOWN_CODE:
				return parent::getFailedView(RESPONSE_F_UNKOWN_CODE, 'Unkown verify code.');
				break;
			case RESPONSE_F_UNKOWN_UUID:
				return parent::getFailedView(RESPONSE_F_UNKOWN_UUID, 'Unkown UUID.');
				break;
			case RESPONSE_F_RESPONSE_OWNER:
				return parent::getFailedView(RESPONSE_F_RESPONSE_OWNER, 'Don\'t response to yourself.');
				break;
			case RESPONSE_F_UNKOWN_SESSION:
				return parent::getFailedView(RESPONSE_F_UNKOWN_SESSION, 'Unkown session.');
			case RESPONSE_F_UNKOWN_RESON:
			default:
				return parent::getFailedView(RESPONSE_F_UNKOWN_REASON, 'Unkown reason.');
		}
	}

}